package com.limit.utils;

public class StringUtil {

	public static String parseRequestUrl(String contextUrl,String url){
		url=url.replaceFirst(contextUrl, "");
		int pos = url.lastIndexOf("/");
		if(0 < pos){
			url = url.substring(0, pos)+"/index";
		}
		return url;
	}

	/** 
	 * 将请求拼接成符合后台检测的URL
	 *	/admin/slide/index
	 *	/admin/slide/
	 *	/admin/slide/view
	 *
	 */
	public static String parseURL(String servletPath) {
		if(servletPath.endsWith("/")){
			return servletPath+"index";
		}else{
			return servletPath;
		}
	}
	
	
	public static String valueOf(Object obj){
		
		return obj == null || obj.equals("") ? null : String.valueOf(obj);
	}
}
